package com.kuaiditu.assistant.ui.scan;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.kuaiditu.assistant.R;
import com.kuaiditu.assistant.entity.TaskExpressItem;
import com.kuaiditu.assistant.util.JudgeExpressUtil;
import com.kuaiditu.assistant.util.OrderStateUtil;

import java.text.SimpleDateFormat;
import java.util.List;

/**
 * Created by Eenie on 2017/8/30.
 * Email: eeniework@gmail.com
 * Des:
 */

public class DeliveryAdapter extends BaseQuickAdapter<TaskExpressItem,BaseViewHolder> {

    private int express_com_id;

    private SimpleDateFormat mSimpleDateFormat;
    public DeliveryAdapter( @Nullable List<TaskExpressItem> data, int express_com_id) {
        super(R.layout.item_delivery_scan, data);
        mSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.express_com_id = express_com_id;
    }

    @Override
    protected void convert(BaseViewHolder helper, TaskExpressItem item) {
        helper.setText(R.id.tv_express, item.getOrderItem_expressOrderNo())
                .setText(R.id.tv_state_des, OrderStateUtil.getOrderItemStateDes(item.getOrderItem_status()))
                .setText(R.id.tv_time, mSimpleDateFormat.format(item.getOrderItem_createTime()));


        TextView textView = helper.getView(R.id.tv_express_com);
        JudgeExpressUtil.analyze(express_com_id, textView);

    }
}
